import { reactive, onMounted, ref, nextTick } from 'vue'
import useInstance from '@/hooks/useInstance';
import { getMenuListApi } from '@/api/menu/menu'
import menu from '@/store/modules/menu';
export default function RoleTableDate() {
  const { global, proxy } = useInstance()

  const menuTableDate = reactive({
    list: [],
    Loading: false,
    height: 0,
    total: 0
  })
  onMounted(() => {
    getMenuList()
    nextTick(() => {
      menuTableDate.height = window.innerHeight - 125
    })
  })
  const getMenuList = async () => {
    menuTableDate.Loading = true
    const res: any = await getMenuListApi()
    console.log(res, 'res');

    if (res.code === 200) {
      menuTableDate.list = res.data
      menuTableDate.Loading = false
    }
  }
  const tableRowClassName = ({ row, rowIndex }) => {
    if (rowIndex % 2 === 1) {
      return "warning-row";
    } else {
      return "success-row";
    }
  }

  return {
    menuTableDate, getMenuList, tableRowClassName
  }
}